from sre_constants import SUCCESS
import time


def add_data_time(data):
    """给数据添加时间

    Args:
        data (_type_): _description_

    Returns:
        _type_: _description_
    """
    c_time = "Ctime"
    m_time = "Mtime"
    curr_time = time.time()
    if isinstance(data, dict):
        data[c_time] = curr_time
        data[m_time] = curr_time

    if isinstance(data, list):
        for k in data:
            val = data[k]
            for c in val:
                val[c_time] = curr_time
                val[m_time] = curr_time
            data[k] = val
    return data


def update_data_time(data):
    """修改时添加的数据

    Args:
        data (_type_): _description_

    Returns:
        _type_: _description_
    """
    # c_time = "Ctime"
    m_time = "Mtime"
    curr_time = time.time()
    if isinstance(data, dict):
        data[m_time] = curr_time
    return data



